package com.gaokao.demo.controller;


import cn.hutool.json.JSONUtil;
import com.gaokao.demo.entity.SysRole;
import com.gaokao.demo.service.IRoleService;
import com.gaokao.demo.utils.JwtTokenUtil;
import com.gaokao.demo.vo.ResultResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.List;


/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author szs
 * @since 2021-01-22
 */
@RestController
@RequestMapping("/role")
public class RoleController{

    @Autowired
    private IRoleService roleService;

    @RequestMapping("/getRoles")
    @ResponseBody
    public String getRoles(){
        List<SysRole> roleList = this.roleService.list();
        ResultResponse resultResponse = ResultResponse.newSuccess("success",roleList);

        return JSONUtil.toJsonStr(resultResponse);
    }

}
